/**
*  Copyright 2009-2014 by WWW.KNET.CN  All rights reserved.
*/
package com.domain.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.domain.mapper.ICloudWebMessageMapper;
import com.domain.model.CloudWebMessage;

/**
 * TODO(这里用一句话描述这个类的作用)
 * @author liujie
 * @date 2015年4月17日 下午1:25:05
 * 
 */
@Service(value="cloudWebMessageService")
public class CloudWebMessageService {
	@Resource
	 private ICloudWebMessageMapper cloudWebMessageMapper;
	 public  void add(CloudWebMessage obj){
		 obj.setMesWhen(new Date());
		 obj.setIfDelete(0l);
		 cloudWebMessageMapper.add(obj);
	 }

	  public  void update(CloudWebMessage msg){
		  CloudWebMessage obj=cloudWebMessageMapper.get(msg.getId());
		  obj.setMesName(msg.getMesName());
		  obj.setMesContent(msg.getMesContent());
		  obj.setPorCode(msg.getPorCode());
		  obj.setMesAccessory(msg.getMesAccessory());
		  obj.setMesAuthor(msg.getMesAuthor());
		  obj.setMesCatagory(msg.getMesCatagory());
		  obj.setMesUrl(msg.getMesUrl());
		  obj.setMesIfreview(msg.getMesIfreview());
		  obj.setMesSubtitle(msg.getMesSubtitle());
//		  obj.setMesStatus(msg.getMesStatus());
		  cloudWebMessageMapper.update(obj);
	  }
	  public  void deleteById(Long paramLong){
		  CloudWebMessage obj=cloudWebMessageMapper.get(paramLong);
		  obj.setIfDelete(1l);
		  cloudWebMessageMapper.update(obj);
	  }


	  public  CloudWebMessage get(Long paramLong){
		  return cloudWebMessageMapper.get(paramLong);
				  
	  }
	  //置顶
	  public  void head(Long id){
		  CloudWebMessage obj=cloudWebMessageMapper.get(id);
		  if (null != obj) {
			 Long status=obj.getMesStatus();
			 if (null == status || status.equals("") || status.equals(0l)) {
				 obj.setMesStatus(1l);
			 }else {
				obj.setMesStatus(0l);
			}
			cloudWebMessageMapper.update(obj);
		}
				  
	  }
	  public  List<CloudWebMessage> getList(Map<String, Object> paramMap){
		  return cloudWebMessageMapper.getList(paramMap);
	  }

	  public  List<CloudWebMessage> getListPage(Map<String, Object> paramMap){
		  return cloudWebMessageMapper.getListPage(paramMap);
	  }
	  public  Long getRows(Map<String, Object> paramMap){
		  return cloudWebMessageMapper.getRows(paramMap);
	  }

	  public  void updateText(CloudWebMessage paramCloudWebMessage){
		  
		  cloudWebMessageMapper.update(paramCloudWebMessage);
	  }

	  
}
